﻿package com.android.helix;

import android.opengl.GLES20;
import android.util.Log;

public final class Utils {
	public static enum ShaderPart{ DIF, ALPHA, EMIS_M, SPEC_M, FRES_M, MULTY_TEX_M, NORMAL_TEX, MULTY_TEX};

	public final static String TAG = "Helix";
	
	public static enum AnimNames{ IDLE, IDLE_01, IDLE_02, IDLE_03,
           RUN, WALK, 
           HIT, HIT1, HIT2, HIT3, 
           JUMP, JUMP_START, JUMP_LOOP,
           JUMP_END };

    public static enum BlendType {NONE, ALPHA, ADD, MUL} 
    public static enum mTypes{BYTE, SHORT, FLOAT};	

    public static final int INDEX_TYPE = GLES20.GL_UNSIGNED_SHORT;
    public static final int INDEX_BYTE_SIZE = 2;
	
    public static final String VERTEX_SHADER_PATH = "shaders/vs.vs";
    public static final String FRAGMET_SHADER_PATH = "shaders/vs.fs";
	
    public static void checkGlError(String op) {
        int error;
        while ((error = GLES20.glGetError()) != GLES20.GL_NO_ERROR) {
            Log.e(TAG, op + ": glError " + error);
            throw new RuntimeException(op + ": glError " + error);
        }
    }
	
	public static final String[] VISOBJ_VERTEX_ATTRIB_NAMES = {"aPosition","aColor","aNormal", 
		"aTangent", "aBinormal", "aTexcoord","aSkinWeight","aJointID"};
	public static final int[] VISOBJ_VERTEX_ATTRIB_ELEMENT_COUNT = {3, 4, 3, 
		3, 3, 4, 4, 4};
	public static final int[] VISOBJ_VERTEX_ATTRIB_TYPE = {GLES20.GL_FLOAT, GLES20.GL_UNSIGNED_BYTE, GLES20.GL_FLOAT, 
		GLES20.GL_FLOAT, GLES20.GL_FLOAT, GLES20.GL_FLOAT, GLES20.GL_FLOAT, GLES20.GL_UNSIGNED_BYTE};
	public static final boolean[] VISOBJ_VERTEX_ATTRIB_NORMALIZE = {false, true, false, 
		false, false, false, false, false};
	
	public static int GetVisObjVertexAttribByteSize(int aType){
		switch (aType){
		case GLES20.GL_FLOAT: return 4;
		case GLES20.GL_UNSIGNED_SHORT: return 2;
		case GLES20.GL_UNSIGNED_BYTE: return 1;
		}
		return 0;
	}
	
}


